package com.gitee.tje.waving.aop;

import java.util.ArrayList;
import java.util.List;

/**
 * @author taojiaen
 * @date 2018-03-08 08:45
 */
@Apple
public class AopExample {
    @Bee
    public void testHere() {
        System.out.println("test hereX");
    }



    public static void main(String[] args) {
        PointCutAdvisor advisor1 = new PointCutAdvisor();
        PointCutAdvisor advisor2 = new PointCutAdvisor();
        ApplePointCut applePointCut = new ApplePointCut();
        advisor1.setPointCut(applePointCut);
        advisor1.setAdvice(new AppleMethodHook());

        BeePointCut beePointCut = new BeePointCut();
        advisor2.setAdvice(new BeeMethodHook());
        advisor2.setPointCut(beePointCut);
        List<Advisor> advisors = new ArrayList<>();
        advisors.add(advisor1);
        advisors.add(advisor2);


        AopExample example = (AopExample) new AopCreator(advisors).create(new AopExample());
        example.testHere();
    }
}
